// app.js
App({
    /**
   * 生命周期函数--监听页面加载
   */
    onLaunch() {
      wx.login({
      success:res=>{
      if(res.code){
      console.log('#####code:'+res.code);
        let url ="https://api.weixin.qq.com/sns/jscode2session?appid=wxb9740b2cae66f086&secret=a1d407d4bcd3a77ecf704b5dccb45ae8&js_code="+res.code+'&grant_type=authorization_code'
        wx.request({
        url:url,
        success:function(res){
          console.log('#####openid:'+res.data.openid);
          console.log('#####session_key:'+res.data.session_key);
          console.log('#####unionid:'+JSON.stringify(res.data,null,3));
        }
      })
      }
      }
      })
        wx.cloud.init({
          env:'cloud1-4gfslrwt829212a3'
        })
    },

    globalData: {
        userInfo: null,
    }
})
